<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>JavaScript转换整数类型的简单应用</title>
    </head>
    <body>
        <h3>JavaScript转换整数类型的简单应用</h3>
        <hr />
        <p>
            var x = "3.14";
        </p>
        <script>
		//初始化变量x
		var x = "3.14";
		//直接使用+号
		var result1 = x+1;
		//转换为整数后使用+号
		var result2 = parseInt(x)+1;
		//输出结果
		alert("x+1= "+result1+"\nparseInt(x)+1= "+result2);
        </script>
    </body>
</html>